<?php
/**
 *
 * Created by PhpStorm
 * User: kalvin
 * DateTime: 2021/6/4 4:28 下午
 *
 */


namespace App\Logic;


use App\Repository\UserRepository;

class UserLogic
{
    public function login(int $id1, int $id2) : array
    {
        $userRepository = new UserRepository();
        $userInfo = $userRepository->getUserById($id1, $id2);
        if ($userInfo->isEmpty()) {
            $userInfo = $userRepository->createUser($id1, $id2);
        }

        return $userInfo->toArray();
    }
}
